/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 *  Copyright 2021 Collate
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
 * DataAssetDir entity
 */
export interface CreateDataAssetDir {
    /**
     * Children teams. An `Organization` can have `BusinessUnit`, `Division` or `Department` as
     * children. A `BusinessUnit` can have `BusinessUnit`, `Division`, or `Department` as
     * children. A `Division` can have `Division` or `Department` as children. A `Department`
     * can have `Department` as children.
     */
    children?: EntityReference[];
    /**
     * When `true` indicates the entity has been soft deleted.
     */
    deleted?: boolean;
    /**
     * Optional description of the team.
     */
    description?: string;
    /**
     * 文件夹类型，部分来自组织部门的同步映射，部分来自创建
     */
    dirType: DirType;
    /**
     * Optional name used for display purposes. Example 'Marketing Team'.
     */
    displayName?: string;
    /**
     * Email address of the team.
     */
    email?: string;
    /**
     * List of user/login names of users who are experts in this Domain.
     */
    experts?: string[];
    /**
     * Can any user join this team during sign up? Value of true indicates yes, and false no.
     */
    isJoinable?: boolean;
    name:        string;
    /**
     * Owner of this team.
     */
    owner?: EntityReference;
    /**
     * parent dir id.
     */
    parentId?: string;
    /**
     * parent dir type.
     */
    parentType?: string;
    /**
     * Optional team profile information.
     */
    profile?: Profile;
}

/**
 * Children teams. An `Organization` can have `BusinessUnit`, `Division` or `Department` as
 * children. A `BusinessUnit` can have `BusinessUnit`, `Division`, or `Department` as
 * children. A `Division` can have `Division` or `Department` as children. A `Department`
 * can have `Department` as children.
 *
 *
 * 此模式定义了用于引用实体的EntityReferenceList类型，EntityReference用于捕获从一个实体到另一个实体的关系。例如，表具有一个名为数据库的EntityReference类型的属性，该属性捕获表“属于”数据库的关系。
 *
 * This schema defines the EntityReference type used for referencing an entity.
 * EntityReference is used for capturing relationships from one entity to another. For
 * example, a table has an attribute called database of type EntityReference that captures
 * the relationship of a table `belongs to a` database.
 *
 * Owner of this team.
 */
export interface EntityReference {
    /**
     * If true the entity referred to has been soft-deleted.
     */
    deleted?: boolean;
    /**
     * Optional description of entity.
     */
    description?: string;
    /**
     * Display Name that identifies this entity.
     */
    displayName?: string;
    /**
     * Fully qualified name of the entity instance. For entities such as tables, databases
     * fullyQualifiedName is returned in this field. For entities that don't have name hierarchy
     * such as `user` and `team` this will be same as the `name` field.
     */
    fullyQualifiedName?: string;
    /**
     * Link to the entity resource.
     */
    href?: string;
    /**
     * Unique identifier that identifies an entity instance.
     */
    id: string;
    /**
     * If true the relationship indicated by this entity reference is inherited from the parent
     * entity.
     */
    inherited?: boolean;
    /**
     * Name of the entity instance.
     */
    name?: string;
    /**
     * Entity type/class name - Examples: `database`, `table`, `metrics`, `databaseService`,
     * `dashboardService`...
     */
    type: string;
}

/**
 * 文件夹类型，部分来自组织部门的同步映射，部分来自创建
 */
export enum DirType {
    BusinessUnit = "BusinessUnit",
    Department = "Department",
    Dir = "Dir",
    Division = "Division",
    Group = "Group",
    Organization = "Organization",
}

/**
 * Optional team profile information.
 *
 * 此模式定义了用户、团队或组织的个人资料类型
 */
export interface Profile {
    images?:       ImageList;
    subscription?: MessagingProvider;
}

/**
 * 链接到不同分辨率/尺寸的图像列表
 */
export interface ImageList {
    image?:    string;
    image192?: string;
    image24?:  string;
    image32?:  string;
    image48?:  string;
    image512?: string;
    image72?:  string;
}

/**
 * 保存不同类型的订阅配置
 */
export interface MessagingProvider {
    gChat?:   Webhook;
    generic?: Webhook;
    msTeams?: Webhook;
    slack?:   Webhook;
}

/**
 * This schema defines webhook for receiving events from OpenMetadata.
 */
export interface Webhook {
    /**
     * Endpoint to receive the webhook events over POST requests.
     */
    endpoint?: string;
    /**
     * List of receivers to send mail to
     */
    receivers?: string[];
    /**
     * Secret set by the webhook client used for computing HMAC SHA256 signature of webhook
     * payload and sent in `X-OM-Signature` header in POST requests to publish the events.
     */
    secretKey?: string;
    /**
     * Send the Event to Admins
     */
    sendToAdmins?: boolean;
    /**
     * Send the Event to Followers
     */
    sendToFollowers?: boolean;
    /**
     * Send the Event to Owners
     */
    sendToOwners?: boolean;
}
